﻿@{
    Layout = "_LayoutPhone";
}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<link rel="apple-touch-icon" href="~/GoTRI/img/favicon-apple.png">
<link rel="icon" href="~/GoTRI/img/favicon.png">
<title>到访</title>

<!-- Material design icons CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/materializeicon/material-icons.css">

<!-- aniamte CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/animatecss/animate.css">

<!-- swiper carousel CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/swiper/css/swiper.min.css">

<!-- daterange CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/bootstrap-daterangepicker-master/daterangepicker.css">

<!-- footable CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/footable-bootstrap/css/footable.bootstrap.min.css">

<!-- jvector map CSS -->
<link rel="stylesheet" href="~/GoTRI/vendor/jquery-jvectormap/jquery-jvectormap-2.0.3.css">

<!-- app CSS -->
<link id="theme" rel="stylesheet" href="~/GoTRI/css/purplesidebar.css" type="text/css">

<script src="~/admui-13945148017-1592211513218/public/js/tsk/sweetalert.min.js"></script>
<script>

    $(document).ready(function () {
        //var KeHuId = getQuery("KeHuId");
        BindAnChang();

        $('#dl_AnChang').change(function () {
            var AnChangId = $("#dl_AnChang").find("option:selected").val();
            BindZhiYeGuWen(AnChangId);
        })
        $('#a').removeAttr("href");
        $('#a').attr('href', "javascript:void(window.location.href = '../PhoneKeHu/MyCustomerDetail?KeHuId=" + getQuery('KeHuId') + "&panduan=" + getQuery('panduan') + "&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing") + "')");
    });



    function BindAnChang() {
        $.ajax({
            type: 'POST',
            url: '../PhoneKeHu/BindAnChang',
            async: false,
            dataType: 'json',
            success: function (data) {
                var optionstring = "";
                if (data.length > 0) {
                    for (var j = 0; j < data.length; j++) {
                        optionstring += "<option value=\"" + data[j].Id + "\" >" + data[j].AnChangMingCheng + "</option>";
                    }
                }
                //alert(123);
                $("#dl_AnChang").html("<option value='0'>请选择</option> " + optionstring);
                $("#dl_ZhiYeGuWen").html("<option value='0'>请选择</option> ");
            },
        })
    }


    function BindZhiYeGuWen(AnChangId) {
        $.ajax({
            type: 'POST',
            url: '../PhoneKeHu/BindZhiYeGuWen',
            async: false,
            dataType: 'json',
            data: { "AnChangId": "" + AnChangId + "" },
            success: function (data) {
                var optionstring = "";
                if (data.length > 0) {
                    for (var j = 0; j < data.length; j++) {
                        optionstring += "<option value=\"" + data[j].Id + "\" >" + data[j].XingMing + "</option>";
                    }
                }
                //alert(123);
                $("#dl_ZhiYeGuWen").html("<option value='0'>请选择</option> " + optionstring);
            },
        })
    }

    function Submit() {
        $("#nb").removeAttr("hidden");
        $("#btn_TiJiao").attr("disabled", "disabled");
        var KeHuId = getQuery("KeHuId");
        //var KeHuId = 3;
        var BeiZhu = $("#txt_BeiZhu").val();
        var ZhiYeGuWenId = $("#dl_ZhiYeGuWen").find("option:selected").val();
        //alert(KeHuId)
        $.ajax({
            type: "POST",
            url: "../PhoneKeHu/ShenQingLaiFang",
            cache: false,  //禁用缓存
            data: { "BeiZhu": "" + BeiZhu + "", "ZhiYeGuWenId": "" + ZhiYeGuWenId + "", "KeHuId": "" + KeHuId + "" },  //传入组装的参数
            dataType: "text",
            success: function (result) {
                $("#nb").attr("hidden", "");
                $("#btn_TiJiao").attr("disabled", false);
                if (result == "success") {
                    swal("成功提示!", "操作成功!", "success");
                    setTimeout(function () { window.location.href = "MyCustomerDetail?KeHuId=" + KeHuId + "" + "&fanhuiweizhi=" + getQuery("fanhuiweizhi") + "&leixing=" + getQuery("leixing"); }, 2000);
                    //location.href = "KeHuXiangXi?KeHuId=" + KeHuId+"";
                    //setTimeout(function () { window.location.href = "../PhoneShouYe/ShouYe"; }, 2000);
                }
                if (result == "error") {
                    swal("失败提示!", "操作出现异常!", "error");
                }
            }
        });
    }


    function getQuery(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
</script>
<header style="width: 100%; height: 4rem; background-color: rgb(255,135,0);top:0px;position: fixed;z-index: 1;">
    <a href="javascript:void(window.location.href = '../PhoneKeHu/MyCustomerDetail?KeHuId=' + getQuery('KeHuId'))" id="a">
        <img src="~/GoTRI/img/left.png" alt="" style="float: left;
            width: 1rem;
            height: 2rem;
            margin-left: 1rem;
            margin-top: 1rem;
            position:absolute;
	        left:0px;
	        top:0px;
	        z-index:1;">
    </a>
    <div style=" width: 100%; height: 4rem; line-height: 4rem; text-align: center; color: #fff; font-size: 1.3rem;">来访客户</div>
</header>
<script>
    $(".yi").attr("hidden", "");
</script>
<div class="container mt-4 main-container">
    <div class="card mb-4">
        <div class="card-header border-bottom py-4 text-center">
            <br>
            <h1 class="content-color-primary mb-0 text-center font-weight-light">Report/来访</h1>
        </div>
        <div class="card-body">
            <div class="row justify-content-center">
                <div class="col-md-10 mx-auto" style="margin-bottom:-40px;">
                    <div class="row ">
                        <div class="col-lg-12 col-md-12">
                            <div class="form-group ">
                                <label>案场<span style="color:red;"></span></label>
                                <select id="dl_AnChang" class="form-control"></select>
                            </div>
                        </div>
                    </div>
                    <div class="row ">
                        <div class="col-lg-12 col-md-12">
                            <div class="form-group ">
                                <label>置业顾问<span style="color:red;"></span></label>
                                <select id="dl_ZhiYeGuWen" class="form-control"></select>
                            </div>
                        </div>
                    </div>
                    <div class="row ">
                        <div class="col-lg-12 col-md-12">
                            <div class="form-group ">
                                <label>备注<span style="color:red;"></span></label>
                                <textarea id="txt_BeiZhu" cols="20" rows="9" class="form-control"></textarea>
                            </div>
                        </div>
                    </div>
                    <br>

                </div>
            </div>
        </div>
        <div class="card-footer" style="text-align: center;width:100%;margin-bottom:70px;">
            <button class="btn btn-success float-right" onclick="Submit();" id="btn_TiJiao" style="width:100%">提交</button>
        </div>
    </div>
</div>
<div style="margin-bottom: 50px;padding-bottom:1px"></div>
